<!--
 * @Author: chunlai
 * @Date: 2025-11-17 15:23:54
 * @LastEditTime: 2025-11-26 09:56:48
 * @LastEditors: minsheng_insurance_agency_zhoucl
 * @FilePath: \01.latest-short-insure\src\renewal\components\Insued.vue
 * @Description: 被保人
-->
<template>
  <div class="customer_infos">
    <div class="info-mode-head">
      <span class="head-box title">
        {{ `被保险人${bbrList.length > 1 ? `${bindex + 1}` : ""}` }}
      </span>
      <div class="flex-end">
        {{ msgObj.relationToAppnt == "4" ? "本人" : msgObj.name }}
        <span
          :class="enfold ? 'ms-row2-icon' : 'ms-row-icon'"
          style="margin-left: 8px"
          @click="enfold = !enfold"
          v-if="msgObj.relationToAppnt != '4'"
        ></span>
      </div>
    </div>
    <div
      class="enfold-model"
      :class="{ disabledForm: disabledEdit }"
      v-if="enfold && msgObj.relationToAppnt != '4'"
    >
      <div class="info-mode-head">
        <span class="head-box">为谁投保</span>
        <div class="flex-end">
          {{ msgObj.relationToAppntName }}
        </div>
      </div>
      <div class="info-mode-head">
        <span class="head-box">证件类型</span>
        <div class="flex-end">
          {{ msgObj.idName }}
        </div>
      </div>
      <div class="info-mode-head">
        <span class="head-box">证件号码</span>
        <div class="flex-end">
          {{ msgObj.idNum }}
        </div>
      </div>
      <div class="info-mode-head" v-if="msgObj.phone">
        <span class="head-box">手机号</span>
        <div class="flex-end">
          {{ msgObj.phone }}
        </div>
      </div>
      <div class="info-mode-head">
        <span class="head-box">有无社保</span>
        <div class="flex-end">
          <MsRadio
            :curVal="msgObj.socialInsuFlag"
            btnType="socialInsuFlag"
            labelName="text"
            valueName="keyId"
            flexName="mag0"
            :arrList="socialSecList"
            @clickEvent="changeRadioInfo"
          />
        </div>
      </div>
    </div>
    <!-- <div class="notice-mode-head" :class="{ disabledForm: disabledEdit }">
      <span class="head-box">健康告知</span>
      <div
        class="flex-end"
        :class="gzFlagName ? '' : 'c3'"
        @click="showHealthPop"
      >
        {{ gzFlagName || "请填写" }}
        <span class="ms-row-icon" style="margin-left: 8px"></span>
      </div>
    </div> -->
    <!-- 健康告知 -->
    <!-- <HealthyPop
      :ref="`bbr${bindex}gz`"
      @setValue="setHealthyStatus"
      @close="closeEvent"
      v-if="healthyPop"
    /> -->
  </div>
</template>

<script>
import { mapGetters } from "vuex";
// import HealthyPop from "@/views/form/components/HealthyPop.vue";
export default {
  name: "InsuedInfo",
  props: {
    bindex: {
      type: Number,
      default: () => 0,
    },
    msgObj: {
      type: Object,
      default: () => {},
    },
  },
  components: {},
  data() {
    return {
      enfold: false,
    };
  },
  computed: {
    ...mapGetters({
      bbrList: "insert/assuredList",
      socialSecList: "dictionary/socialSecList",
    }),
    // gzFlagName: {
    //   get() {
    //     let res = "";
    //     if (this.msgObj.healthyStatus == "Y") {
    //       res = "通过";
    //     } else if (this.msgObj.healthyStatus == "N") {
    //       res = "未通过";
    //     }
    //     return res;
    //   },
    //   set(val) {
    //     // console.log(val);
    //   },
    // },
  },
  watch: {},
  created() {},
  mounted() {},
  methods: {
    // showHealthPop() {
    //   if (!this.msgObj.idNum) return this.$toast("请填写客户信息");
    //   this.healthyPop = true;
    //   this.$nextTick(() => {
    //     this.$refs[`bbr${this.bindex}gz`].initModuleDatas(`${this.bindex}`);
    //   });
    // },
    // closeEvent(value) {
    //   this.setHealthyStatus(value);
    //   this.healthyPop = false;
    // },
    // setHealthyStatus(value) {
    //   if (value) {
    //     this.changeData(
    //       {
    //         healthyStatus: value,
    //       },
    //       "0"
    //     );
    //   }
    // },
    changeRadioInfo(obj, key) {
      let data = {
        socialInsuFlag: obj.keyId,
        socialInsuFlagName: obj.text,
      };
      this.changeData(data);
    },
    changeData(data, type = "1") {
      this.$store.commit("insert/UPDATE_ASSURED", {
        index: this.bindex,
        data: data,
      });
      this.$forceUpdate();
      if (type == "1") {
        this.$store.dispatch("risks/setRisks", {});
      }
    },
  },
};
</script>
<style lang="less" scoped>
@import "./user.less";
</style>
